﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BLL;

public partial class User_CTIReg_CTIPersonal : System.Web.UI.Page
{
    UserBean bllUser = new UserBean();
    WebUtility utility = new WebUtility();

    protected void Page_Load(object sender, EventArgs e)
    {
        this.txt_Birth.Attributes.Add("onfocus", "WdatePicker({skin:'ext',dateFmt:'yyyy-MM-dd'})");
        if (!IsPostBack)
        {
            WebUtility.BindList("行业属性", ddl_Vocation);
            WebUtility.BindList("文化程度代码", ddl_Education);
        }
    }

    protected void btn_Submit_Click(object sender, ImageClickEventArgs e)
    {
        string accountNO = Request.QueryString["AccountNO"].ToString();
        string name = this.realName.Text;
        string sex = this.rb_Man.Checked ? this.rb_Man.Text : this.rb_Woman.Text;
        string phone = this.phone.Text;
        string email = this.email.Text; 
        string vocation = this.ddl_Vocation.SelectedIndex != 0 ? this.ddl_Vocation.SelectedItem.Text : "";
        string address = this.txt_Address.Text;
        string zipCode = this.txt_ZipCode.Text;
        string education = this.ddl_Education.SelectedIndex != 0 ? this.ddl_Education.SelectedItem.Text : "";
        string birth = this.txt_Birth.Text;
        string like = this.txt_Like.Text;

        int count = bllUser.AddContact_CTIUser(Guid.NewGuid().ToString(), accountNO, name, sex, phone, email, vocation, address, zipCode, education, birth, like);
        if (count > 0)
        {
            utility.AlertMsg("用户信息修改成功！");
            Response.Redirect(WebUtility.getWebRootPath() + "/Login/Login.aspx");
        }
        else
        {
            utility.AlertMsg("发生异常，请联系管理员！");
        }
    }
}
